/**
 * @see https://umijs.org/docs/max/access#access
 * */
export default function access(initialState: { currentUser?: any } | undefined) {
  const { currentUser } = initialState ?? {};
  return {
    canSuper: currentUser && currentUser.userInfo.role === 'super',
    canAdmin: currentUser && (currentUser.userInfo.role === 'admin' || currentUser.userInfo.role === 'super'),
    canSingleAdmin: currentUser && currentUser.userInfo.role === 'admin',
    canSingleNormal: currentUser && currentUser.userInfo.role === 'normal',
  };
}
